<?php
/**
 * Created by PhpStorm.
 * User: Dick
 * Date: 2016/3/29
 * Time: 11:18
 */

namespace Controller;

use Method\JSON;
use Model\Picture;

class UpLoad
{
    public static function upload()
    {
        $userid = $_SESSION['user']->id;
        $file = $_POST['file'];
        if (!$file) {
            return;
        }
        $time = date('Y-m-d H:i:s');
        $sendpic = new Picture();
        $sendpic->upload($userid, $file, $time);
    }

    public static function upload2()
    {
        $userid = $_SESSION['user']->id;
        $file = $_POST['file'];
        if (!$file) {
            return;
        }
        $time = date('Y-m-d H:i:s');
        $sendpic = new Picture();
        $sendpic->upload($userid, $file, $time);

    }

    public static function delpicture()
    {
        $picid = intval($_POST['id']);
        Picture::delpic($picid);
        JSON::json();
    }

    public static function delpicture2()
    {
        $picid = intval($_POST['id']);
        Picture::delpic($picid);
        JSON::json();
    }
}